import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Gameover extends JFrame implements ActionListener {
    JLayeredPane layeredPane;
    JPanel panel1, panel2;
    JLabel label;
    ImageIcon img;
    JButton button1, button2;

    public static void main(String[] args) {
        new Gameover();
    }

    public Gameover() {
        this.setTitle("德州扑克 - 游戏结束");
        layeredPane = new JLayeredPane();
        img = new ImageIcon(".\\image\\gameover.png");
        panel1 = new JPanel();
        panel2 = new JPanel();
        Font f1 = new Font("微软雅黑", Font.PLAIN, 35);
        panel1.setBounds(0, 0, img.getIconWidth(), img.getIconHeight());
        label = new JLabel(img);
        panel1.add(label);
        button1 = new JButton("离开");
        button2 = new JButton("开溜");
        button1.addActionListener(this);
        button2.addActionListener(this);
        button1.setSize(200, 100);
        button1.setLocation(500, 600);
        button1.setFont(f1);
        button2.setSize(200, 100);
        button2.setLocation(800, 600);
        button2.setFont(f1);
        // panel2.add(button1);
        // panel2.add(button2);
        layeredPane.add(panel1, -1);
        layeredPane.add(button1, 0);
        layeredPane.add(button2, 0);
        // layeredPane.add(panel2, 2);

        this.setLayeredPane(layeredPane);
        this.setSize(img.getIconWidth(), img.getIconHeight());
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setLocationRelativeTo(null);
        this.setVisible(true);
    }

    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == button1 || e.getSource() == button2) {
            Test.link.println("<Bye>");
            System.exit(0);
        }
    }
}
